<?php
/*
 * 递归遍历
 * @param $data array
 * @param $id int
 * return array
 * */
function recursion($data, $id=0) {
 $list = array();
 foreach($data as $v) {
	 if($v['pid'] == $id) {
		 $v['son'] = recursion($data, $v['id']);
		 if(empty($v['son'])) {
			 unset($v['son']);
		 }
		 	array_push($list, $v);
		 }
	 }
	 return $list;
}